var bearcat = require('bearcat');
var _ = require('lodash');

var ProxyBannerController = function () {
  this.$id = "ProxyBannerController";
  this.ControllerHelper = null;
  this.DBMgr = null;
  this.$init = 'init';
  this.moduleName = 'proxy_banner';
};

ProxyBannerController.prototype.init = function() {
  this.ControllerHelper = bearcat.getBean('ControllerHelper', {owner:this});
  this.DBMgr = bearcat.getBean('DBMgr');
};

//查询房间ID
ProxyBannerController.prototype.queryType = function(req, res) {
  var where = {
    type: req.params.type
  }
  var model = bearcat.getBean('DBMgr').getModel('db_game_platform', 'proxy_banner');
  model.findOne({where: where})
      .then(function(obj) {
        if(!obj) {
          res.json({});
        } else {
          obj = obj.toJSON();
          res.json({code: 200,values:obj});
        }
      })
      .catch(function (e) {
        console.error(e);
        res.json({code: 500});
      });
};


bearcat.module(ProxyBannerController, typeof module !== 'undefined' ? module : {});